1. Field of the Invention
The present invention relates to a motion picture experts group (MPEG) video decoder and more particularly to a motion vector decoder for decoding a motion vector (MV).
2. Description of Related Art
Recently, digitalization of information has already been developed extensively. As a result, the picture compressing technology is becoming the major concern for multimedia. An MPEG is the international standard for coding the digital data of moving picture and is considered as the most effective compressing technology in the multimedia environment. The MPEG technology is widely used as the compressing algorithm in communication, broadcasting, game and the like including a digital TV.
The MPEG video compressing algorithm is based upon two elementary technologies. A block-based motion estimation and compensation of the video are used to reduce the temporal redundancy. Also, a discrete cosine transform (DCT) is used to reduce the spatial redundancy. The motion compensation prediction coding methods use pure predictive encoding and an interpolation encoding predictor, while the prediction error is further compressed through the DCT.
The discrete cosine transformed signals are quantized to reduce the volume of data by expressing the data with a predetermined number of bits. The quantized data is then subjected to variable length coding (VLC) to reduce the overall number of bits by expressing a value frequently appearing with a few bits and a value rarely appearing with many bits. Motion vectors are measured in units of 16.times.16 blocks and transmitted with variable length coded transform coefficient information. The motion vectors are subjected to the VLC to maximize coding efficiency.
The motion vector (MV) is a two-dimensional vector which indicates an offset of a field coordinate in a reference frame against a current field coordinate or picture. However, the MV may indicate an offset of a frame coordinate in a reference frame or an offset of a field picture. The motion vector is used for the motion compensation. Thus, an encoder must first obtain the MV to estimate motion.
A maximum of 4 MVs can be obtained per macroblock, but transmitting the obtained MVs directly may results in a transmission of a substantial number of bits. To reduce the bits for transmission, the difference between MVs of the current and the preceding macroblock is coded VLC and transmitted. The MV value of the preceding macroblock is stored in a MV predictor and is expressed as pmv[r][s][t]. Namely, the pmv value is the MV of the preceding macroblock (MB) and a value to be coded by the encoder is "vector[r][s][t]-pmv[r][s][t]". The parameters "r" for field type, "s" for picture type, and "t" for direction of vector typically have values of either 0 or 1 and have meanings as shown in Table 1 below. Also, "DMV" represents a difference between the two MVs.
TABLE 1 0 1 r first MV in MB second MV in MB s forward MV backward MV t horizontal element vertical element
For encoding the MV, a block matching is used and a search range must be set in advance for the block matching. The encoder informs a decoder of the preset search range with an f_code. The f_code may have four different sets of MV ranges depending on the s and t values. The decoder would recognize the search range from the f_code according to Table 2 which is an example set of an allowable MV search range as a function of the f_code[s][t] when t=1. The search range for the MV is determined based upon the performance of the encoder in the MPEG.
TABLE 2 Vertical element of field f_code [s] [t] vector in frame picture All other cases 0 (forbidden) 1 [-4:+3.5] [-8:+7.5] 2 [-8:+7.5] [-16:+15.5] 3 [-16:+15.5] [-32:+31.5] 4 [-32:+31.5] [-64:+63.5] 5 [-64:+63.5] [-128:+127.5] 6 [-128:+127.5] [-256:+255.5] 7 [-256:+255.5] [-512:+511.5] 8 [-512:+511.5] [-1024:+1023.5] 9 [-1024:+1023.5] [-2048:+2047.5] 10.about.15 (reserved)
The search ranges shown in Table 2 are represented in units of 1/2 pixels and are multiplied by 2 to make the range values into whole numbers before encoding. For example, in a case of a MV on a horizontal axis, when f_code is 1, the corresponding value in Table 2 is [-8:+7.5]. After multiplication by 2, a "HIGH" value or a maximum displacement is 15, and a "LOW" value or a minimum displacement is -16. The resulting search range is 32, including 0.
In the example above, the DMV is within the range of [-31:+31]. Also, the MV is divided by a variable f, resulting in a quotient value represented by a motion_code and a residual value represented by a motion_residual. The motion_code and motion _residual values are separately coded when coding the MV. Moreover, f=1 when the f_code is 1 and when f=1, only the motion_code value remains because the motion_residual would be 0.
The motion_code is transmitted according to a VLC table as in Table 3 which shows the values from -16 to +16. However, because the range [-31:+31} is greater than the values of the VLC table, the range must be limited to [-16;15]. The values of [-16:+15] within the values of [-31:+31] are directly used as the motion_code. However, the values of [-31:-17] are adjusted to [1:15] by adding the search range value of 32, and the values of [16:31] are adjusted to [-16,-1] by subtracting the search range value of 32. The adjusted values [1:15] and [-16:-1] are called delta and are set as the motion_code. The decoder adds the obtained deltas derived from the limited range [-16:15] to the pmv in order to obtain the DMV.
TABLE 3 VLC motion_code [r] [s] [t] 00000011001 -16 00000011011 -15 00000011101 -14 00000011111 -13 00000100001 -12 00000100011 -11 0000010011 -10 0000010101 -9 0000010111 -8 00000111 -7 00001001 -6 00001011 -5 0000111 -4 00011 -3 0011 -2 011 -1 1 0 010 1 0010 2 00010 3 0000110 4 00001010 5 00001000 6 00000110 7 0000010110 8 0000010100 9 0000010010 10 00000100010 11 00000100000 12 00000011110 13 00000011100 14 00000011010 15 00000011000 16
Furthermore, the number of MVs is quite considerable and a VLC table allowing direct coding cannot be made. Thus, the MVs must be grouped. Usually, MV values are large for a picture with great amounts of object motion and MV values are small for a picture with little amount of object motion. If the MV values are divided by a certain value f according to the MV values of a picture, one quotient value frequently appears. Also, the distribution of the appearances of this quotient value would almost be even which allows an efficient coding through use of the same VLC table.
However, the residuals are irregular and cannot be variable length coded, but must be fixed length coded according to the value f. For example, when f=2, the motion_residual is coded with one bit and when f=3, the motion_residual is coded with 2 bits. The number of bits for each motion_residual is calculated and extracted from a bit stream. As a result, the delta, vector [r][s][t], and pmv [r][s][t] would be within a range [LOW:HIGH].
Thus far, the encoding process have been reviewed. The decoding is a reverse process of the encoding process and can be represented with a program language. Similar to the encoding process, the variables such as r_size, f, HIGH, LOW, and range, are first measured. When the motion_code is 0 or when f=1, the delta is set as the motion_code. Otherwise, the delta is measured through the reverse process of the encoding process. If the delta is not within the range [LOW:HIGH], the value of the search range must be added to or subtracted from the delta to adjust the value of the motion_code. An example of a program is shown in Formula 1.
 [Formula 1] r_size = f_code[s] [t] -1; F =1 &lt;&lt; r_size; High = (16*f) -1; Low = ((-16)*f); Range = (32*f); if((f==1) .parallel. (motion_code[r] [s] [t] == 0)) Delta = motion_code[r] [s] [t]; Else{ Delta=((Abs(motion_code[r] [s] [t])-1)*f) +motion_residual[r] [s] [t]+1; If(motion_code[r] [s] [t] &lt; 0) Delta = -delta; } Prediction = PMV[r] [s] [t]; if( (mv_format == "1")&&(t==0)&&(picture_structure=="11")) prediction = PMV[r] [s] [t] DIV2; vector'[r] [s] [t] = prediction + delta; if(vector'[r] [s] [t] &lt; low) vector'[r] [s] [t] = vector'[r] [s] [t] + range; if(vector'[r] [s] [t] &lt; high) vector'[r] [s] [t] = vector'[r] [s] [t] - range; if((mv_format=="1")&&(t==1)&&(picture_structure=="11")) PMV[r] [s] [t] = vector'[r] [s] [t]*2; Else PMV[r] [s] [t] = vector'[r] [s] [t]
However, the program exists as a syntax and must be implemented by a hardware structure. Thus, when a circuit is implemented according to the program as is, an adder, a subtracter, a comparator, and a multiplier are required, resulting in a complicated circuit and a slower processing.